/**
 * 初始化函数，需要提前设置原地址栏的id addressId 和 新下拉栏的id selectId
 */
$(document).ready(function() {
	/* 控制地址下拉框的初始值 */
	var address = $('#' + addressId).val();
	address = address.split("-");
	var province = address[0];
	var city = address[1];
	var district = address[2];
	var street = address[3];
	$('#' + selectId).distpicker({
		province : province,
		city : city,
		district : district
	});
	/* 控制街道的初始值 */
	$("#street").val(street);
	/* 设置原input框为隐藏 */
	$("#" + addressId).attr('type', 'hidden');
});
/**
 * 把下拉栏获取的省市区处理成省-市-区-街道模式的地址并改变隐藏address的值
 */
function getFormatAddress(provinceId, cityId, districtId, streetId) {
	var province = $("#" + provinceId).val();
	var city = $("#" + cityId).val();
	var district = $("#" + districtId).val();
	var street = $("#" + streetId).val();
	var address = province + '-' + city + '-' + district + '-' + street;
	/* 修改修改隐藏域地址为新地址 */
	$("#" + addressId).val(address);
	return address;
}
/* 控制下拉js 结束 */